import axios from './request'
// 获取角色列表
export const getRoleAPI = () => axios.get('/users/roles')
// 添加角色
export const addRoleApi = (data) => axios.post('/users/roles', data)
// 删除角色
export const delRoleApi = (_id) => axios.delete('/users/roles/'+_id)
// 修改角色
export const editRoleApi = ({_id, roleName, roleDesc}) => axios.patch('/users/roles/'+_id,{roleName, roleDesc})
// 获取单个角色的已有权限
export const getOneRoleApi = (_id) => axios.get('/users/role_perm/'+_id)
// 获取权限列表树状结构
export const getPermissionlistApi = () => axios.get('/users/permission/tree')
// 分配权限
export const getRightApi = ({roleid, data}) => axios.patch('/users/setRole/'+roleid, {data})
// 删除角色对应的某条权限
export const deleteRightApi = ({roleid, rightlist}) => axios.post('/users/delRole/'+roleid, {rightlist})